
#import "FAMEncryptString.h"

const char *FAM_CString(const FAMEncryptStringData *data)
{
    if (data->decoded == 1) return data->value;
    for (int i = 0; i < data->length; i++) {
        data->value[i] ^= data->factor;
    }
    ((FAMEncryptStringData *)data)->decoded = 1;
    return data->value;
}

NSString *FAM_OCString(const FAMEncryptStringData *data)
{
    return [NSString stringWithUTF8String:FAM_CString(data)];
}
